<?php
namespace App\Model;

use Hyperf\DbConnection\Model\Model;

class Excel extends Model
{
    protected ?string $table = 'excel';

    protected array $fillable = [
        'excel_id', 'name', 'status', 'type', 'path', 'admin_id', 'is_del', 'message', 'created_at', 'updated_at', 'deleted_at',
    ];
    protected string $primaryKey = 'excel_id';
    protected ?string $dateFormat = 'U';


    public function getCreatedAtAttribute($value)
    {
        return $value ? date('Y-m-d H:i:s', intval($value)) : '';
    }

    public function admin(){
        return $this->hasOne(CustomerAdmin::class,"id","admin_id");
    }
}